package demo1;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * Date: 2025-03-02
 * Time: 21:26
 */
public class demo2 {
    private static boolean isRepeat(String str2 ,char ch) {
        for (int i = 0; i < str2.length(); i++) {
            char ch1 = str2.charAt(i);
            if(ch1 == ch) {
                return true;
            }
        }
        return false;
    }

    public static void main(String[] args) {
        String str1 = "welcome to bit";
        String str2 = "come";
        List<Character> list = new ArrayList<>();


        for (int i = 0; i < str1.length(); i++) {
            char ch = str1.charAt(i);
            if (!str2.contains(ch+"")){
                list.add(ch);
            }
        }

        Iterator<Character> it = list.iterator();
        while(it.hasNext()) {
            System.out.print(it.next());
        }
        System.out.println();
//        System.out.println(list);
    }
    public static void main1(String[] args) {
        String str1 = "welcome to bit";
        String str2 = "come";
        List<String> list = new ArrayList<>();


        StringBuilder stringBuilder = new StringBuilder();
        for (int i = 0; i < str1.length(); i++) {
            char ch = str1.charAt(i);
            if (!isRepeat(str2,ch)) {
                stringBuilder.append(ch);
            }
        }
        list.add(stringBuilder.toString());
        System.out.println(list);
    }
}
